//
//  HX_DetailClass.m
//  08 - UItableVIew
//
//  Created by 韩旭 on 16/7/25.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "HX_DetailClass.h"
#import "HX_ Details.h"
#import "Model.h"
@implementation HX_DetailClass
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self creatLableFrame:frame];
    }
    return self;
}

- (void)creatLableFrame:(CGRect)frame {
    self.lableName = [[UILabel alloc] initWithFrame:CGRectZero];
    _lableName.backgroundColor = [UIColor whiteColor];
    _lableName.textAlignment = 0;
    [self addSubview:_lableName];
    self.lableAge = [[UILabel alloc] initWithFrame:CGRectZero];
    _lableAge.backgroundColor = [UIColor whiteColor];
    _lableAge.textAlignment = 0;
    [self addSubview:_lableAge];
    self.telephoto = [[UILabel alloc] initWithFrame:CGRectZero];
    _telephoto.backgroundColor = [UIColor whiteColor];
    _telephoto.textAlignment = 0;
    [self addSubview:_telephoto];
    
    self.gender = [[UILabel alloc] initWithFrame:CGRectZero];
    _gender.textAlignment = 0;
    _gender.backgroundColor = [UIColor whiteColor];
    [self addSubview:_gender];
}

- (void)setModelClass:(Model *)modelClass {
    _modelClass = modelClass;
    
    _lableName.text = [NSString stringWithFormat:@"姓名：%@", modelClass.name];
    _lableAge.text = [NSString stringWithFormat:@"年龄：%ld", modelClass.age];
    _telephoto.text = [NSString stringWithFormat:@"电话：%@", modelClass.phoneNumber];
    _gender.text = [NSString stringWithFormat:@"性别：%@", modelClass.gender];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _lableName.frame = CGRectMake(0, 10, kWidth, 50);
    _lableAge.frame = CGRectMake(0, _lableName.frame.size.height + _lableName.frame.origin.y + 10, kWidth, _lableName.frame.size.height);
   _gender.frame = CGRectMake(0, _lableAge.frame.origin.y + _lableAge.frame.size.height + 10, kWidth, _lableAge.frame.size.height);
    _telephoto.frame = CGRectMake(0, _gender.frame.size.height + _gender.frame.origin.y + 10, kWidth, _gender.frame.size.height);
}
@end
